//
//  POPBasicPOPViewAlpha.m
//  TestPop
//
//  Created by XuDong Jin on 14-5-1.
//  Copyright (c) 2014年 XuDong Jin. All rights reserved.
//

#import "POPBasicPOPViewAlpha.h"
#import "POPBasicAnimation.h"

@interface POPBasicPOPViewAlpha ()
@end
@implementation POPBasicPOPViewAlpha

- (void)viewDidLoad
{
    [super viewDidLoad];
    //添加手势
    UITapGestureRecognizer *gestureForSpring = [[UITapGestureRecognizer alloc] init];
    [gestureForSpring addTarget:self action:@selector(changeAlpha:)];
    [self.view addGestureRecognizer:gestureForSpring];
}

- (void)changeAlpha:(UITapGestureRecognizer*)tap{
    POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha];
    anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    float alpha = _basicView.alpha;
    if (alpha==1.0) {
        anim.toValue = @(0.0);
    }
    else{
        anim.toValue = @(1.0);
    }
    [_basicView pop_addAnimation:anim forKey:@"alpha"];
}

@end
